/*
 ============================================================================
 Name		: Flashbox4ProMainView.cpp
 Author	  : HeQun
 Version	 : 1.0
 Copyright   : 
 Description : CFlashbox4ProMainView implementation
 ============================================================================
 */
#include "Flashbox4ProMainView.h"
#include "Flashbox4.hrh"
#include  <aknviewappui.h>


CFlashbox4ProMainView::~CFlashbox4ProMainView()
{
	if(m_pProMainContainer)
	{
		AppUi()->RemoveFromViewStack(*this, m_pProMainContainer);
		delete m_pProMainContainer;
	}
	
}

void CFlashbox4ProMainView::ConstructL()
{
	//继承父类构造
	BaseConstructL();
}

/**
 * From CAknView returns Uid of View
 * @return TUid uid of the view
 */
TUid CFlashbox4ProMainView::Id( ) const
{
	return TUid::Uid(EProMainViewId);
}

/**
 * From MEikMenuObserver delegate commands from the menu
 * @param aCommand a command emitted by the menu 
 * @return void
 */
void CFlashbox4ProMainView::HandleCommandL(TInt aCommand )
{
	switch(aCommand)
	{
		
	}
}
/**
 * From CAknView reaction if size change
 * @return void
 */
void CFlashbox4ProMainView::HandleClientRectChange()
{
	if(m_pProMainContainer)
	{
		m_pProMainContainer->SetExtentToWholeScreen();
	}
}

/**
 * From CAknView activate the view
 * @param aPrevViewId 
 * @param aCustomMessageId 
 * @param aCustomMessage 
 * @return void
 */
void CFlashbox4ProMainView::DoActivateL(const TVwsViewId& aPrevViewId, 
		TUid aCustomMessageId, const TDesC8& /*aCustomMessage*/ )
{
	if (!m_pProMainContainer )
	{
		m_pProMainContainer = new (ELeave) CFlashbox4ProMainContainer;
		m_pProMainContainer->SetMopParent (this);
		m_pProMainContainer->ConstructL ( ClientRect ( ) ,aPrevViewId.iViewUid, aCustomMessageId.iUid);
		m_pProMainContainer->SetExtentToWholeScreen();
		AppUi()->AddToStackL (*this, m_pProMainContainer);
	} 
}

/**
 * From CAknView deactivate the view (free resources)
 * @return void
 */
void CFlashbox4ProMainView::DoDeactivate( )
{
	if ( m_pProMainContainer )
	{
		AppUi()->RemoveFromViewStack ( *this, m_pProMainContainer );
		delete m_pProMainContainer;
		m_pProMainContainer = NULL;
	}
}
